"use strict";

var eeui = app.requireModule('eeui');
var umengPush = app.requireModule("eeuiUmengPush");
var storage = weex.requireModule("storage");
Vue.mixin({
  data: function data() {
    return {
      globalData: {
        Color: '#3EB4FF',
        APP_BASE_API: 'https://api.365.qmin365.cn:8443',
        mchId: '10200',
        mchName: '全民365',
        uuid: null,
        userInfo: null,
        token: null,
        shopId: null,
        shopName: '全民365'
      },
      APP_TYPE: 0,
      VERSION: 4,
      location: false,
      companyName: '全民365',
      shareData: {
        title: '全民爱心驿站',
        url: 'http://365.qmin365.cn',
        thumb: 'http://cdn.rzico.com/qm365/ic_launcher.png',
        description: '欢迎注册并使用全民爱心驿站'
      }
    };
  },
  created: function created() {
    var _this = this;

    var data = eeui.getCachesString("globalData");

    if (!this.isEmptyString(data)) {
      var globalData = JSON.parse(data);

      if (!this.isEmptyString(globalData.APP_BASE_API)) {
        this.globalData = globalData;
      }
    }

    if (this.globalData.uuid == null) {
      _this.globalData.uuid = this.getImei();
    }

    var dataStr = JSON.stringify(this.globalData);
    eeuiLog.log(dataStr);
    eeui.setCachesString("globalData", dataStr);
  },
  methods: {
    getGlobalData: function getGlobalData() {
      var data = eeui.getCachesString("globalData");

      if (!this.isEmptyString(data)) {
        var globalData = JSON.parse(data);

        if (!this.isEmptyString(globalData.APP_BASE_API)) {
          this.globalData = globalData;
        }
      }

      return this.globalData;
    },
    setGlobalData: function setGlobalData(data) {
      this.globalData = data;
      var dataStr = JSON.stringify(this.globalData);
      eeui.setCachesString("globalData", dataStr);
    }
  }
});